<?php

class CF_Util_Array
{
	/**
	 * 
	 * @param mixed $data
	 * @return mixed
	 */
	public static function stripSlashesRecursive(& $data)
	{
		if(is_array($data)){
			foreach ($data as &$value) {
				$value = self::stripSlashesRecursive($value);
			}
		}elseif(is_string($data)){
			$data = stripslashes($data);
		}
		
		return $data;
	}
	
	/**
	 * 
	 * @param mixed $data
	 * @return mixed
	 */
	public static function addSlashesRecursive(& $data)
	{
		if(is_array($data)){
			foreach ($data as &$value) {
				$value = self::stripSlashesRecursive($value);
			}
		}elseif(is_string($data)){
			$data = addslashes($data);
		}
		
		return $data;
	}
}